import Vue from 'vue'
import Router from 'vue-router'
import { SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG } from 'constants';

Vue.use(Router)

export default new Router({

  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      if (from.meta.keepAlive) {
    　　from.meta.savedPosition = document.documentElement.scrollTop;	
      }
      return { x: 0, y: to.meta.savedPosition || 0}
    }
  },
        
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'index',
      component: resolve => require(['@/page/index'], resolve),
      children: [
        {
          path: 'send-goods',
          name: 'sendGoods',
          component: resolve => require(['@/page/send-goods/send-goods'], resolve)
        },
        {
          path: 'get-manifest',
          name: 'getManifest',
          component: resolve => require(['@/page/get-manifest/get-manifest'], resolve)
        },
        {
          path: 'my',
          name: 'my',
          component: resolve => require(['@/page/my/my'], resolve)
        }
      ]
    },
    
  ]
})
